/*************************************************************************************************
 * Class to represent a general (abstract) geometric elements. 
 * This class will be extended by other classes, that will implement its abstract methods
 *************************************************************************************************/
package geometricElement;
import ground.GroundObject;

public abstract class GeometricElement extends GroundObject {

	// members
	private double area; // element's area
	
	// methods
	/*************************************************************************************************
	 * Function name: public GeometricElement(int xCord, int yCord)
	 * Input: Position
	 * Output: None
	 * Function operation: Constructor- creates a new geometric element at given position. Area will
	 * 					   be set according to derived class
	 *************************************************************************************************/
	public GeometricElement(int xCord, int yCord) {
		// set members as given values
		super(xCord, yCord);
	}
	
	/*************************************************************************************************
	 * Function name: protected void setArea(double area)
	 * Input: Element's area
	 * Output: None
	 * Function operation: Sets area attribute as given value
	 *************************************************************************************************/
	protected void setArea(double area) { this.area = area;} 
	
	/*************************************************************************************************
	 * Function name: public abstract double getArea()
	 * Input: None
	 * Output: Geometric element's area
	 * Function operation: Returns area attribute- calculated differently by each derived class
	 *************************************************************************************************/
	public double getArea() { return area; }
	
	/*************************************************************************************************
	 * Function name: public abstract double calculateArea()
	 * Input: None
	 * Output: Void
	 * Function operation: Calculates element's area according to derived class's type
	 *************************************************************************************************/	
	public abstract double calculateArea();
	
	/*************************************************************************************************
	 * Function name: public abstract GeometricElement clone()
	 * Input: None
	 * Output: Reference to object's copy (according to implementing derived class)
	 * Function operation: Allocates a new object with activating object's attributes and returns a 
	 * 					   reference to the copy 
	 *************************************************************************************************/
	public abstract GeometricElement clone();
	
	// TODO check if necessary
	public String toString() {
		return String.format("Area: %f", getArea());
	}
}